//
//  LMPostFrame.m
//  舍品
//
//  Created by 楼 眉 on 16/2/25.
//  Copyright © 2016年 楼 眉. All rights reserved.
//

#import "LMPostFrame.h"
#import "LMPost.h"
static int const titleBgViewHeight = 40;
@implementation LMPostFrame

- (void)setPost:(LMPost *)post
{
    _post = post;
    CGFloat topViewX = 10;
    CGFloat topViewY = 0;
    CGFloat topVIewW = SCREEN_WIDTH - 20;
    CGFloat topViewH = 40;
    self.topViewF = CGRectMake(topViewX, topViewY, topVIewW, topViewH);
    
    CGFloat iconViewX = 5;
    CGFloat iconViewY = 5;
    CGFloat iconViewW = 30;
    CGFloat iconViewH = 30;
    self.iconViewF = CGRectMake(iconViewX, iconViewY, iconViewW, iconViewH);
    
    CGFloat nameLabelX = CGRectGetMaxX(self.iconViewF) + 5;
    CGFloat nameLabelY = self.iconViewF.origin.y;
    CGFloat nameLabelW = SCREEN_WIDTH / 2;
    CGFloat nameLabelH = 30;
    self.nameLabelF = CGRectMake(nameLabelX, nameLabelY, nameLabelW, nameLabelH);
    
    CGFloat timeLabelY = self.iconViewF.origin.y;
    CGFloat timeLabelW = 100;
    CGFloat timeLabelX = topVIewW - timeLabelW - 5;
    CGFloat timeLabelH = 30;
    self.timeLabelF = CGRectMake(timeLabelX, timeLabelY, timeLabelW, timeLabelH);

    CGFloat pictureViewX  = 10;
    CGFloat pictureViewY  = CGRectGetMaxY(self.topViewF);
    CGFloat pictureViewW  = SCREEN_WIDTH  - 20;
    CGFloat pictureViewH  = 180;
    self.pictureViewF = CGRectMake(pictureViewX,pictureViewY,pictureViewW,pictureViewH);
    
    CGFloat postTitleLabelX  = 0;
    CGFloat postTitleLabelY  = pictureViewH - titleBgViewHeight;
    CGFloat postTitleLabelW  = pictureViewW;
    CGFloat postTitleLabelH  = titleBgViewHeight;
    self.postTitleLabelF = CGRectMake(postTitleLabelX,postTitleLabelY,postTitleLabelW,postTitleLabelH);
    
    CGFloat bottomViewX  = 10;
    CGFloat bottomViewY  = CGRectGetMaxY(self.pictureViewF);
    CGFloat bottomViewW  = SCREEN_WIDTH - 20;
    CGFloat bottomViewH  = 40;
    self.bottomViewF = CGRectMake(bottomViewX, bottomViewY, bottomViewW, bottomViewH);
    
    CGFloat reportBtnX  = bottomViewW - bottomViewH;
    CGFloat reportBtnY  = 0;
    CGFloat reportBtnW  = bottomViewH;
    CGFloat reportBtnH  = bottomViewH;
    self.reportBtnF = CGRectMake(reportBtnX, reportBtnY, reportBtnW, reportBtnH);
    
    self.cellHeight = CGRectGetMaxY(self.bottomViewF) + 10;
}

@end
